//脚本唯一关键字,通过该关键字找到对应脚本，每个脚本必须有该描述。
var v_script_id = 'auth_6';
//脚本状态,0:该脚本不许执行，1:该脚本可以执行
var v_status = '1';

//脚本逻辑写在run语句之间
if (run   && action.getAuthority().is(4)){
	var user = action.getSession().getAttribute("user");
	var userid = action.form.getString('userid');
	action.vars.put(action.V_TABLE_NAME,'v_auth_roles');//指定获取数据的表名
	action.vars.put(action.V_MAX_LINE,'20');//每页显示多少条
	if(user.getRolekind()<3){
		action.vars.put(action.V_CONDITION, ' where id not in (select roleid from h_auth_role_users where userid=' + userid + ') order by id desc');//数据检索条件
	}else{
		action.vars.put(action.V_CONDITION, ' where userid = ' + user.getId() + ' and id not in (select roleid from h_auth_role_users where userid=' + userid + ') order by id desc');//数据检索条件
	}
	action.vars.put(action.V_OUTPUT_FILE_FORMAT,'3');
}